package com.hunttown.common.domain;

import java.io.Serializable;

final class Order implements Serializable {
    private Order.Direction direction;
    private String property;

    private Order(Order.Direction direction, String property) {
        this.direction = direction;
        this.property = property;
    }

    public static Order asc(String property) {
        return new Order(Order.Direction.asc, property);
    }

    public static Order desc(String property) {
        return new Order(Order.Direction.desc, property);
    }

    public String toString() {
        return this.property + " " + this.direction.name();
    }

    public static enum Direction {
        asc,
        desc;

        private Direction() {
        }
    }
}